
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%--
  Created by IntelliJ IDEA.
  User: E550
  Date: 2017/8/18
  Time: 18:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
%>

<script type="text/javascript" charset="utf-8" src="<%=basePath%>/editor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="<%=basePath%>/editor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="<%=basePath%>/editor/lang/zh-cn/zh-cn.js"></script>

<html>
<head>
    <c:import url="/WEB-INF/jsp/frontend/head.jsp"/>
    <c:import url="/WEB-INF/jsp/frontend/script.jsp"/>
    <link rel="stylesheet" href="<spring:url value="/css/newBlog.css"/>" />

    <title>Community</title>
</head>

<body>

<c:import url="/WEB-INF/jsp/frontend/header.jsp" />

<div class="blog-new-main">
    <div class="blog-new-bar">
        <div class="blog-new-submit">
            发表帖子
        </div>
    </div>

    <input id="title" class="blog-new-title" type="text" placeholder="请输入标题"/>
    <div id="c" class="blog-new-editor" style="min-height: 500px"></div>
</div>


<div id="submit" class="blog-new-button"><p>发 布</p></div>


<script>
    jQuery("#submit").click(function () {
        jQuery.post("/postRelease", {
            release_content: window.ue.getContent(),
            release_postName: jQuery("#title").val(),
        }, function (response) {
            if (response === "true") {
                alert("success");
                location.href = "<spring:url value="../postList" />";
            }
        });
    });
    jQuery(function () {
        window.ue = UE.getEditor('c');
    });
</script>

</body>
</html>